/*
 * @version: 1.0
 * @Author: zhl
 * @Date: 2022-02-10 13:45:23
 * @LastEditors: zhl
 * @LastEditTime: 2022-02-11 13:25:58
 * @Description: 文件实现业务描述
 */
#ifndef __PEMD_JSON_MANAGER_H__
#define __PEMD_JSON_MANAGER_H__

#include "CMosquittoManager.h"
#include "TaskManager.h"
#include "global_data_struct.h"
#include "DataCenterManager.h"

class JsonManager
{
private:
    /* data */
    static JsonManager c_json_manager;

private:
    int  parse_config(std::shared_ptr<CConfigManager> cm, std::shared_ptr<TaskManager> tm, std::shared_ptr<CMosquittoManager> mm, std::shared_ptr<DataCenterManager> dcm, std::string data);
    void remove_config_all();
    void remove_config_gateway();
    void remove_config_task();
    void remove_config_terminal();
    void remove_config_linkage();
    void remove_config_scene();

    int64_t scene_apply(std::string data);

public:
    JsonManager(/* args */);
    ~JsonManager();

    static JsonManager &getInstance();
    int  parse(std::shared_ptr<CConfigManager> cm, std::shared_ptr<TaskManager> tm, std::shared_ptr<CMosquittoManager> mm,std::shared_ptr<DataCenterManager> dcm, std::string data);
    int  run_cmd(std::shared_ptr<CConfigManager> cm, std::shared_ptr<TaskManager> tm, std::shared_ptr<CMosquittoManager> mm, TASK_TYPE type, int64_t req_id, std::string data);
    std::string get_serial_info_json_str(std::shared_ptr<SERIAL_INFO> serial);

    CMD_REQUEST get_cmd_info(std::string cmd_str);
    std::string get_set_const_value_msg(CMD_SET_CONST_VALUE data);
    std::string get_command_name(std::string& data);
};





#endif /* __PEMD_JSON_MANAGER_H__ */